﻿#region Using Directives

using System;

#endregion Using Directives

namespace StooRob.SharePoint.ContentUpdater
{
    /// <summary>
    /// General exception class.
    /// </summary>
    public class StooRobException : ApplicationException
    {
        #region Members

        /// <summary>
        /// Defines the details of the exception
        /// </summary>
        protected string _msg;

        #endregion Members

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="T:StooRob.SharePoint.ContentUpdater.StooRobException"/> class.
        /// </summary>
        public StooRobException()
        {
            _msg = Exceptions.StooRobException;
        }

        /// <summary>
        /// Creates a new StooRobException with the default message and the supplied inner exception.
        /// </summary>
        /// <param name="msg">The exception message text.</param>
        /// <param name="innerException">The inner exception object.</param>
        /// <remarks>Note that msg must be localized before the call and only
        /// refers to the InnerException message.  The Message for the derived class
        /// must still be manually set and localized as normal.
        /// </remarks>
        public StooRobException(string msg, Exception innerException)
            : base(msg, innerException)
        {
            _msg = msg;
        }

        /// <summary>
        /// Creates a new instance of the Exception with the given exception details
        /// </summary>
        /// <param name="details">Provides information concerning the exception</param>
        public StooRobException(string details)
        {
            string s = Exceptions.StooRobException;
            _msg = string.Format(s, details);
        }

        #endregion Constructors and Destructors

        #region Public Properties

        /// <summary>
        /// Provides a description of the exception
        /// </summary>
        public override string Message
        {
            get { return _msg; }
        }

        #endregion Public Properties
    }
}